/*
 * author: VDaras
 */

#include "Color.h"
#include "Surface.h"

namespace sdl
{

Color::Color(Uint8 r, Uint8 g, Uint8 b) : m_r(r), m_g(g), m_b(b)
{
}

Color::~Color()
{
}

Uint8 Color::GetR() const
{
    return m_r;
}

Uint8 Color::GetG() const
{
    return m_g;
}

Uint8 Color::GetB() const
{
    return m_b;
}

Uint32 Color::MapRGB(sdl::Surface& surface) const
{
    Uint32 toReturn = 0;
    SDL_Surface *buffer = surface.GetBuffer();

    if(buffer != NULL)
    {
        toReturn = SDL_MapRGB(buffer->format, m_r, m_g, m_b);
    }

    return toReturn;
}

Uint32 Color::MapRGBA(sdl::Surface& surface, Uint32 alpha) const
{
    Uint32 toReturn = 0;
    SDL_Surface *buffer = surface.GetBuffer();

    if(buffer != NULL)
    {
        toReturn = SDL_MapRGBA(buffer->format, m_r, m_g, m_b, alpha);
    }

    return toReturn;
}

};

